home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GENCSRC.ZIP / READLINE.C < prev    next >
C/C++ Source or Header  |  1987-11-21  |  442b  |  20 lines

  1.                                         /* Chapter 10 - Program 6 */
  2. #include "stdio.h"
  3.  
  4. main()
  5. {
  6. FILE *fp1;
  7. char oneword[100];
  8. char *c;
  9.  
  10.    fp1 = fopen("TENLINES.TXT","r");
  11.  
  12.    do {
  13.       c = fgets(oneword,100,fp1); /* get one line from the file */
  14.       if (c != NULL)
  15.          printf("%s",oneword);    /* display it on the monitor  */
  16.    } while (c != NULL);          /* repeat until NULL          */
  17.  
  18.    fclose(fp1);
  19. }
  20.